//
//  SongerInformationCollectionViewCell.m
//  NewMusic
//
//  Created by chuxinyu123 on 15/11/17.
//  Copyright © 2015年 Going. All rights reserved.
//

#import "SongerInformationCollectionViewCell.h"
#import <SDWebImageManager.h>
#import <UIImageView+WebCache.h>

@implementation SongerInformationCollectionViewCell

- (void)dealloc
{
    [_titleLabel release];
    [_picImage release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self buildTitle];
    }
    return self;
}

- (void)buildTitle
{
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.font = [UIFont systemFontOfSize:15];
    self.titleLabel.backgroundColor = [UIColor clearColor]
    ;
    self.titleLabel.textColor = [UIColor whiteColor];
    self.picImage = [[UIImageView alloc] init];

    [self.contentView addSubview:_titleLabel];
    [self.contentView addSubview:_picImage];
    
    [_titleLabel release];
    [_picImage release];
    [_upView release];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.picImage.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.width);
    self.picImage.layer.masksToBounds = YES;
    self.picImage.layer.cornerRadius = 10;
    self.titleLabel.frame = CGRectMake(0, _picImage.frame.size.height, self.frame.size.width, 30);
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
}

- (void)setSongerModel:(SongerModel *)songerModel
{
    if (_songerModel != songerModel) {
        [_songerModel release];
        _songerModel = [songerModel retain];
    }
    _titleLabel.text = songerModel.title;
    [_picImage sd_setImageWithURL:[NSURL URLWithString:songerModel.pic_url]];
}

@end
